function userPage() {
    $.ajax({
        url:'/admin/userList',
        type:'get',
        dataType:'json',
        success:function (res) {

            console.log(res)

            let str=``;
            let rs='';
            for (let i=0;i<res.length;i++){
                str+=`
                    <tr>  
                        <td>${res[i].userName}</td>
                        <td>${res[i].account}</td>
                        <td>${res[i].balance}</td>
                        <td>${res[i].score}</td>
                        <td><input type="button" value="删除" onclick="delUser(${res[i].id})"></td>
                    </tr>
                `
            }
            $('#box').html(`
<!DOCTYPE html>
<html>
<head>
<style>
table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
}

table, th, td {
  border: 1px solid #ddd;
  text-align: left;
  padding: 8px;
}

th {
  background-color: #f2f2f2;
}

tr:nth-child(even) {
  background-color: #f5f5f5;
}

tr:hover {
  background-color: #e9e9e9;
}

</style>
</head>
<body>

<table>
  <thead>
    <tr>
      <th>用户名</th>
      <th>账号</th>
      <th>余额</th>
      <th>积分</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    ${str}
  </tbody>
</table>

</body>
</html>
    `);
        }
    })
}

function delUser(id) {
    $.ajax({
        url: '/admin/delUser/'+id,
        type: 'get',
        success:function () {
            userPage()
        }
    })
}